import * as crypto from 'crypto';

export default class Crypto{
    static md5(content: string | Buffer){
        let md5 = crypto.createHash('md5');
        md5.update(content);
        return md5.digest('hex');
    }

    static toBase64(content: string){
        return new Buffer(content).toString('base64');
    }

    static fromBase64(content: string){
        return new Buffer(content, 'base64').toString();
    }
}